package com.ekalenchuk.postAd.domain.site;

import java.io.Serializable;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;

import com.ekalenchuk.postAd.domain.commercial.CommercialSite;


@Entity
@Table(name="site")
public class Site implements Serializable {

	private static final long serialVersionUID = -5473855433209247960L;

	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	@Column(name="id")
	private Long id;

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "site", cascade = { CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH, CascadeType.REMOVE })
	@OrderBy("id")
	private List<SiteField> fields;

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "site", cascade = { CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH, CascadeType.REMOVE })
	@OrderBy("id")
	private List<CommercialSite> commercials;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public List<SiteField> getFields() {
		return fields;
	}

	public void setFields(List<SiteField> fields) {
		this.fields = fields;
	}

	public List<CommercialSite> getCommercials() {
		return commercials;
	}

	public void setCommercials(List<CommercialSite> commercials) {
		this.commercials = commercials;
	}
	

}
